//
//  XYReadBookIndexCell.swift
//  XYReadBook
//
//  Created by fox on 2017/9/29.
//  Copyright © 2017年 tsaievan. All rights reserved.
//

import UIKit

import UIKit

class XYReadBookIndexCell: UITableViewCell {

    var model:Chapters? {
        didSet {
            if let model = model {
                titleLab.text = model.title
            }
        }
    }

    /// 是否购买
    let isBuyImageView = UIImageView()
    let titleLab = UILabel()
    let lineView = UIView()
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupUI()
    }


    func setupUI() {

        contentView.addSubview(titleLab)
        contentView.addSubview(lineView)
        contentView.addSubview(isBuyImageView)
        titleLab.font = UIFont.systemFont(ofSize: 13)
        titleLab.textColor = UIColor.hm_color(withRed: 100, green: 100, blue: 100)
        lineView.backgroundColor = UIColor.hm_color(withRed: 242, green: 242, blue: 242)
        isBuyImageView.image = UIImage.init(named: "directory_buy_icon")
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        titleLab.frame = CGRect.init(x: 12, y: 0, width: ScreenWidth - 56 , height: 44)
        lineView.frame = CGRect.init(x: 0, y: 43, width: ScreenWidth, height: 1)
        isBuyImageView.frame = CGRect.init(x: ScreenWidth - 35, y: 10, width: 23, height: 23)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

